Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@unified-latex/unified-latex-util-pegjs

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unified-latex/unified-latex-util-pegjs

PEGjs grammars and tools for constructing unified-latex ASTs

  • 1.8.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.6K
increased by51.89%
Maintainers
0
Weekly downloads
 
Created
Source

unified-latex-util-pegjs

What is this?

Pegjs grammars to help parse strings into a unified-latex Abstract Syntax Tree (AST). Note, because of the dynamic nature of LaTeX, to get a full AST with arguments attached to macros, etc., the tree is parsed multiple times.

Also included are functions to decorate a Ast.Node[] array so that Pegjs can process it as if it were a string. This allows for complex second-pass parsing.

When should I use this?

If you are building libraries to parse specific LaTeX syntax (e.g., to parse tabular environments or systeme environments, etc.).

Install

npm install @unified-latex/unified-latex-util-pegjs

This package contains both esm and commonjs exports. To explicitly access the esm export, import the .js file. To explicitly access the commonjs export, import the .cjs file.

Functions

decorateArrayForPegjs(array)

Pegjs operates on strings. However, strings and arrays are very similar! This function adds charAt, charCodeAt, and substring methods to array so that array can then be fed to a Pegjs generated parser.

function decorateArrayForPegjs(array: any[]): StringlikeArray;

Parameters

ParamType
arrayany[]

splitStringsIntoSingleChars(nodes)

Splits all multi-character strings into strings that are all single characters.

function splitStringsIntoSingleChars(nodes: Ast.Node[]): Ast.Node[];

Parameters

ParamType
nodesAst.Node[]

Keywords

FAQs

Package last updated on 21 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc